/*
 * can.h
 *
 *  Created on: 2025年4月25日
 *      Author: Administrator
 */

#ifndef CAN_CAN_H_
#define CAN_CAN_H_
#include "MyFreertos.h"
/* Select OSC24Mhz as master flexcan clock source */
#define FLEXCAN_CLOCK_SOURCE_SELECT (1U)
/* Clock divider for master flexcan clock source */
#define FLEXCAN_CLOCK_SOURCE_DIVIDER (1U)
/* Get frequency of flexcan clock */
#define CAN1_CLK_FREQ ((CLOCK_GetRootClockFreq(kCLOCK_Root_Can1) / 100000U) * 100000U)
#define CAN2_CLK_FREQ ((CLOCK_GetRootClockFreq(kCLOCK_Root_Can2) / 100000U) * 100000U)
#define RX_MESSAGE_BUFFER_NUM (2)
#define TX_MESSAGE_BUFFER_NUM (1)
void Can1Init(uint32_t bitrate);
void Can2Init(uint32_t bitrate);
void Can1Send(flexcan_frame_t can1_send_data);
void Can2Send(flexcan_frame_t can2_send_data);
#endif /* CAN_CAN_H_ */
